package edu.sdwu.liqing.qasystem.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

@Data
@Accessors(chain = true)
public class BaseEntity {


    private static final long serialVersionUID = 1L;
    @TableId(value = "id", type = IdType.ID_WORKER_STR)
    private String id;
    @ApiModelProperty(value = "创建者",hidden = true)
    @TableField(value = "create_by", fill = FieldFill.INSERT)
    private String createdBy;
    @TableField(exist = false)
    @ApiModelProperty(hidden = true)
    private String createdName;
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "创建时间",hidden = true)
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private Date createdTime;
    @ApiModelProperty(value = "更新者",hidden = true)
    @TableField(value = "update_by", fill = FieldFill.UPDATE)
    private String updatedBy;
    @TableField(exist = false)
    @ApiModelProperty(hidden = true)
    private String updatedName;
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "更新时间",hidden = true)
    @TableField(value = "update_time", fill = FieldFill.UPDATE)
    private Date updatedTime;
    @TableLogic(value = "0", delval = "1")
    @TableField(value = "del_flag", select = false, fill = FieldFill.INSERT)
    @ApiModelProperty(value = "逻辑删除",hidden = true)
    private Integer delFlag;

    public BaseEntity() {
        super();
        this.delFlag = 0;
    }
}
